package com.linxianqin.springbootVue.domain.page;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.linxianqin.springbootVue.domain.entity.SysLogininfor;
import com.linxianqin.springbootVue.utils.ServletUtils;
import lombok.extern.slf4j.Slf4j;


/**
 * 功能描述：表格数据处理
 * @author lxq
 * @version 1.00
 * @Date 2020/12/13
 */
@Slf4j
public class TableSupport
{
    /**
     * 当前记录起始索引
     */
    public static final String PAGE_NUM = "pageNum";

    /**
     * 每页显示记录数
     */
    public static final String PAGE_SIZE = "pageSize";

    /**
     * 排序列
     */
    public static final String ORDER_BY_COLUMN = "orderByColumn";

    /**
     * 排序的方向 "desc" 或者 "asc".
     */
    public static final String IS_ASC = "isAsc";

    /**
     * 封装分页对象
     */
    public static <T> Page<T> getPage()
    {
        Page<T> page = new Page<>();
        page.setCurrent(ServletUtils.getParameterToInt(PAGE_NUM));
        page.setSize(ServletUtils.getParameterToInt(PAGE_SIZE));
        return page;
    }

    public static  <T> Page<T> buildPageRequest()
    {
        return getPage();
    }

}
